<template>
	<view class="agreements">
		<checkbox-group @change="setAgree" class="checkbox-group">
			<checkbox style="transform: scale(0.7);" :checked="agree" />
			<text>我已阅读并同意</text>
			<text class="agreement" @click="navigateTo('')">《用户服务协议》</text>
			<text>和</text>
			<text class="agreement" @click="navigateTo('')">《用户隐私协议》</text>
		</checkbox-group>
	</view>
</template>

<script>
	export default {
		name:"agreements",
		props:{
			agree: {
				type: Boolean,
				default: false
			}
		},
		methods:{
			navigateTo({url, title}){
				uni.navigateTo({
					url: '/pages/common/webview/webview?url='+url+'&title='+title,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			setAgree(e){
				this.new_agree = !this.agree
				this.$emit('update:agree', this.new_agree)
			}
		},
		data() {
			return {
				isAgree:false
			};
		}
	}
</script>

<style lang="scss" scoped>
.agreements{color:#8a8f8b;font-size: 24rpx;}
.checkbox-group{display: inline-block;}
.agreement{color:#04498c;}
</style>
